///////////////////////////////////////////////////////////////////////////////
// Project: Hoyo Client Game
//
// hy_pet_logic.h
// Created: 2013-7-15
// Author: Like Cheng
///////////////////////////////////////////////////////////////////////////////
#pragma once
#include "hy_includes.h"

class hy_pet_data;
typedef std::map< int, hy_pet_data* > hy_pet_data_map;
class hy_pet_logic : public hy_object
{
public:
	hy_pet_logic();
	virtual ~hy_pet_logic();

	static hy_pet_logic*		instance();
	static void					purge_instance();
public:
	void						player_login_ok( void* mg );
	void						proc_player_info( void* );

	void						send_player_all_pet( int player_id );

	bool						add_pet_data( hy_pet_data* pet_data, bool update = true );
	hy_pet_data*				get_pet_data_by_pet_id( int pet_id );
	void						remove_pet_data_by_pet_id( int pet_id );

	Json::Value					get_pet_json_by_pet_id( int player_id, bool is_from_db = false );

	hy_pet_data_map&			get_pet_data_map(){ return m_pet_data_map; }
	bool						pet_data_map_clear();

	hy_pet_data_map				get_player_all_pet_data_map( int player_id );
public:
	void						add_pet_exp( int player_id,	int add_exp );
private:
	hy_pet_data_map				m_pet_data_map;

};